package com.ynding.spring.idea.ddd.core.model.wechat.domain;

import com.ynding.spring.idea.ddd.core.model.wechat.dp.PhoneNumber;
import com.ynding.spring.idea.ddd.core.model.bo.AggregateRoot;
import com.ynding.spring.idea.ddd.core.model.wechat.entity.Wallet;
import com.ynding.spring.idea.ddd.core.model.wechat.valobj.AssetVO;
import com.ynding.spring.idea.ddd.core.model.wechat.valobj.NickName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * <p> 微信账号</p>
 *
 * @author ynding
 * @version 2022/4/26
 **/
@Data
@ApiModel(value = "WechatAccount", description = "微信账号")
public class WechatAccount implements AggregateRoot<PhoneNumber> {

    @ApiModelProperty("ID")
    private PhoneNumber id;

    @ApiModelProperty("昵称")
    private NickName nickName;

    @ApiModelProperty("钱包")
    private Wallet wallet;

    private WechatAccount() {
    }

    /**
     * 付款
     *
     * @param asset
     */
    public void withdraw(AssetVO asset) {
        wallet.pay(asset);
    }

    /**
     * 收款
     *
     * @param asset
     */
    public void deposit(AssetVO asset) {
        wallet.receive(asset);
    }
}
